import random
import string
import os


def random_string(length=6, digits=True):
    chars = string.ascii_letters + (string.digits if digits else "")
    return "".join(random.sample(chars, length))


def os_random(length=6):
    return os.urandom(length).hex()
